package JavaExercise;

import java.util.Scanner;

public class RefArrayDemo {

    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        Dog [] dogs = new Dog[3];
        Chick [] chicks = new Chick[3];
        Fish [] fish = new Fish[3];

        for (int i=0; i<dogs.length*3;i++){
            System.out.println("录入名字");
            String name = sc.nextLine();
            System.out.println("录入年龄");
            int    age = sc.nextInt();
            System.out.println("录入颜色");
            String color = sc.next();
            if (i<3)
            dogs[i] = new Dog(name,age,color);
            else if (i<6) {
                chicks[i] = new Chick(name,age,color);
            }
            else  {
                fish[i] = new Fish(name,age,color);
            }

        }
        for (int i = 0 ; i<dogs.length;i++){
            dogs[i].eat();
            dogs[i].swim();
            dogs[i].lookHome();
            dogs[i].drink();
        }
    }
}
